#!/bin/bash

#make executable with chmod +rx test

BUILD_DIR=../test
TARG_X=tests

clear

rm -r $BUILD_DIR
rm *.tix

echo calling ghc...

ghc -Wall \
    -fhpc \
    --make Tests.hs \
    -o $TARG_X \
    -outputdir $BUILD_DIR

mv $TARG_X $BUILD_DIR  #why doesn't -o $BUILD_DIR/$TARG_X work above? 

echo running main...

$BUILD_DIR/$TARG_X

echo calling hpc...

hpc markup $TARG_X --exclude=Main --destdir=$BUILD_DIR  #doesn't run executable, uses fhpc output in local .hpc dir

rm *.tix

echo opening report...

open $BUILD_DIR/hpc_index.html

echo done w/test.